package com.example.shop_2210

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.setupWithNavController
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.ToastUtils
import com.example.base.entity.LoginEntity
import com.example.base.mvvm.BaseViewActivity
import com.example.shop_2210.databinding.ActivityShopBinding

/**
 * ARouter路由跳转
 * 无参跳转：ARouter.getInstance().build("/app/sss").navigation()
 * 有参：
 * 一个字段
 * ARouter.getInstance().build("/app/sss").withString("url","http://qqqq).navigation()
 * 接收方
 * @Autowired
 * @JvmField
 * var url=""
 *
 * initView()添加  ARouter.getInstance().inject(this)  置顶写
 * 一个实体类
 *
 * 首先 传递的参数继承Serializable
 * ARouter.getInstance().build("/app/sss").withSerializable("user",实体类).navigation()
 * 接收方
 * @Autowired
 * lateinit var user:实体类
 * initView()添加  ARouter.getInstance().inject(this)  置顶写
 *
 *
 */
@Route(path = "/app/ShopActivity")
class ShopActivity : BaseViewActivity<ActivityShopBinding>() {
    //接收整个实体类
  /*  @Autowired
    lateinit var user: LoginEntity*/
    override fun initData() {
    }

    override fun initView() {
       /* ARouter.getInstance().inject(this)
        ToastUtils.showLong("接收到的值为${user.phone}${user.nikeName}")*/
        //找到导航宿主fragment
        val navHostFragment = supportFragmentManager.findFragmentById(R.id.fragmentContainerView) as NavHostFragment
        //找到导航控制器
        val navController = navHostFragment.navController
        //和底部导航联动
        binding.bnv.setupWithNavController(navController)
    }

    override fun getLayout(): Int  = R.layout.activity_shop

}